package com.example.androidstudy.ch06;

import com.example.androidstudy.R;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;

public class MultPageEx extends Activity {
	View mpage1;
	View mpage2;
	View mpage3;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.multpage);
		
		 mpage1 = findViewById(R.id.multpage_page1);
		 mpage2 = findViewById(R.id.multpage_page2);
		 mpage3 = findViewById(R.id.multpage_page3);
		
		findViewById(R.id.multpage_btn1).setOnClickListener(mClickListener);
		findViewById(R.id.multpage_btn2).setOnClickListener(mClickListener);
		findViewById(R.id.multpage_btn3).setOnClickListener(mClickListener);
	}
	
	OnClickListener mClickListener= new OnClickListener() {	
		public void onClick(View v) {
			mpage1.setVisibility(View.INVISIBLE);
			mpage2.setVisibility(View.INVISIBLE);
			mpage3.setVisibility(View.INVISIBLE);
			
			
			switch(v.getId()){
			case R.id.multpage_btn1:
				mpage1.setVisibility(View.VISIBLE);
				break;
			case R.id.multpage_btn2:
				mpage2.setVisibility(View.VISIBLE);
				break;
			case R.id.multpage_btn3:
				mpage3.setVisibility(View.VISIBLE);
				break;
			}
			
		}
	};
}
